package menuDao

import (
	"gitee.com/yangguoliang001/go-gin-vue3/QO"
	"gitee.com/yangguoliang001/go-gin-vue3/model"
	"gorm.io/gorm"
)

type MenuDao interface {
	QueryMenuList() (menuList []model.MenuDO, err error)
	QueryMenuUsedList() (menuList []model.MenuDO, err error)
	QueryMenuItemDetail(id string) (menuItem model.MenuDO, err error)
	EditMenu(editReq QO.EditReq) (err error)
	UpdateMenuUsed(usedReq QO.MenuUsedReq) (err error)
	UpdateMenuSort(sortReq QO.MenuSortReq) (err error)
	DeleteMenu(id int32) (err error)
}

type menuDao struct {
	db *gorm.DB
}

func New(db *gorm.DB) MenuDao {
	return &menuDao{
		db: db,
	}
}
